// index.js
// 获取应用实例
const app = getApp()
const API = require('../../http/API')
const http = require('../../http/http')
Page({
  data: {
    isOpen: null,
    // 轮播图
    videoSrc: "http://wxsnsdy.tc.qq.com/105/20210/snsdyvideodownload?filekey=30280201010421301f0201690402534804102ca905ce620b1241b726bc41dcff44e00204012882540400&bizid=1023&hy=SH&fileparam=302c020101042530230204136ffd93020457e3c4ff02024ef202031e8d7f02030f42400204045a320a0201000400",
    indexSlider:[],
    // 八项分类
    classifyArr:[
      {"title":"免费课程",imgUrl:'../../images/h9-b_1806.png'}, {"title":"专业教程",imgUrl:'../../images/h12-g_1806.png'},{"title":"大触直播",imgUrl:'../../images/h2-p_2212.png'},{"title":"教程兑换",imgUrl:'../../images/h10-o_1806.png'},{"title":"学员成长",imgUrl:'../../images/h11-c_2212.png'},{"title":"每日一画",imgUrl:'../../images/h11-c_1811.png'},{"title":"素材下载",imgUrl:'../../images/h14-r_2212.png'},{"title":"社区问答",imgUrl:'../../images/h5-p_2211.png'}
    ],
    // 直播数据
    getBroadcast:[],
    // 热门教程
    hotTeach:[],
    qA:[],
    // 素材
    material:[]
  },
 
  onLoad() {
    http(API.slider,{type:'m',local_code:10,}).then(res=>{
      console.log(res.data.data);
      this.setData({
        indexSlider:res.data.data
      })
    })
    this.getBroadcast()
    this.getHotTeach()
    this.getQAndA()
    this.getMaterial()
  },
  onShow(){
    
  },

  // 获取首页直播的数据
  getBroadcast(){
    http(API.broadcast,{}).then(res=>{
      console.log(res.data.course.data);
      this.setData({
        getBroadcast:res.data.course.data
      })
    })
  },
  // 获取首页热门教程的数据
  getHotTeach(){
    http(API.hotTeach).then(res=>{
      console.log(res.data);
      this.setData({
        hotTeach:res.data
      })
    })
  },
  // 获取首页问答数据
  getQAndA(){
    http(API.qa).then(res=>{
      console.log(res.data);
      this.setData({
        qA:res.data
      })
    })
  },
  // 获取素材
  getMaterial(){
    http(API.mDownload).then(res=>{
      console.log(res.data.data);
      this.setData({
        material:res.data
      })
    })
  },
  
})
